<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>泛微后台————洽公JS逻辑</title>
</head>
<body>
    
</body>
</html>
<script>
    // 泛微后台————长期洽公新版
    jQuery(document).ready(function(){
        // 获取明细表身份证字段值
        WfForm.bindDetailFieldChangeEvent("field1205442",function(id,rowIndex,value){ 
            // 判断身份证字段值是否为十八位
            if(value.length == 18){  
                // 获取性别位
                var sex = Number(value.substring(16,17));
                // 获取年份位
                var year = Number(value.substring(6,10));        
                // 判断性别男女
                if(sex % 2 == 0){
                    // 修改字段值
                    WfForm.changeFieldValue("field1205444_" + rowIndex, {value:1});
                }else{
                    WfForm.changeFieldValue("field1205444_" + rowIndex, {value:0});
                }
                // 获取当前时间，计算年龄
                var data = new Date();
                var age = data.getFullYear() - year;
                WfForm.changeFieldValue("field1205443_" + rowIndex, {value:age});
            }
        });
    });
</script>